package com.hyz.assetManager.pojo;

import com.hyz.pkg.util.GetValue;
import lombok.Data;
import pojo.log.assetInbound.AssetInbound;

import java.util.ArrayList;
import java.util.List;

/**
 * @author HGD
 * @date 2022/9/29 14:09
 */
@Data
public class AssetInboundRequest {
    private List<Long> assetId;
    private Long repositoryId;

    public List<AssetInbound> getAssetInboundList(AssetInboundRequest request, Long assetManagerId) {
        List<AssetInbound> assetInboundList = new ArrayList<>();

        // 获取id，assetId，repositoryId
        Long id = new GetValue().getUuid();
        List<Long> assetIdList = request.getAssetId();
        Long repositoryId = request.getRepositoryId();

        for (Long assetId : assetIdList) {
            AssetInbound assetInbound
                    = AssetInbound.builder()
                    .id(id)
                    .assetId(assetId)
                    .assetManagerId(assetManagerId)
                    .repositoryId(repositoryId)
                    .build();
            assetInboundList.add(assetInbound);

        }
        return assetInboundList;
    }
}
